import scrapy


class CarSpider(scrapy.Spider):
    name = "car"
    allowed_domains = ["www.autohome.com.cn"]
    start_urls = ["https://www.autohome.com.cn/price/brandid_15"]

    def parse(self, response):
        name_list = response.xpath("//div[@class='tw-mb-[30px]']//a[contains(@class,'tw-text-hover')]/text()")
        price_list = response.xpath("//div[contains(@class,'tw-min-w-[436px]')]//a[contains(@class,'tw-text-[16px]')]/text()")
        for i in range(len(name_list)):
            name = name_list[i].extract()
            price = price_list[i].extract()
            print(name,price)
